package com.ai.mall.service.impl;

import com.ai.mall.dao.HotSearchesDao;
import com.ai.mall.entity.HotSearchesEntity;
import com.ai.mall.service.HotSearchesService;
import com.ai.mall.utils.PageUtils;
import com.ai.mall.utils.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("hotSearchesService")
public class HotSearchesServiceImpl extends ServiceImpl<HotSearchesDao, HotSearchesEntity> implements HotSearchesService {

    @Autowired
    private HotSearchesDao hotSearchesDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<HotSearchesEntity> page = this.page(
                new Query<HotSearchesEntity>().getPage(params),
                new QueryWrapper<HotSearchesEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<String> getHotWords() {
        return hotSearchesDao.selectHotWords();
    }

}